<template>
	<view>
		<view style="width: 100%;height: 15rpx;">
		</view>
		<view class="content" v-for="(item,index) in dataarr" :key="item.id" @click="getinfo(item.id)">
			<view style="position: relative;padding-left: 48rpx;">
				<text class="iconte">{{index+1}}</text><text class="text_tlte">{{item.title}}</text>
			</view>
			<view class="con_text">
				<text>{{item.desc}}</text>
			</view>
			<view class="con_date">
				<text class="dataclass">{{item.date}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataarr:[]
			}
		},
		onLoad() {
			this.getlist()
		},
		methods: {
			async getlist(){
				const db = uniCloud.database()
				let res = await db.collection('list_day').orderBy('date desc').get({
					getOne: true
				})
				if (res.result.code === 0) {
					console.log(res.result.data);
					this.dataarr = res.result.data.datanews
				} else {
				
				}
			},
			getinfo(id){
				uni.request({
				    url: 'https://v2.alapi.cn/api/eventHistory/get', //仅为示例，并非真实接口地址。
				    data: {
				        id:id,
				        token:"K8NVh0xvERNNSX1l"
				    },
				    success: (res) => {
				        console.log(res.data);
				    }
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.content{
	border-bottom: 4rpx solid #ccc;
	margin: 0rpx 10rpx;
	margin-bottom: 40rpx;
}
.text_tlte{
	text-align: center;
	font-weight: bold;
	font-size: 32rpx;
}
.iconte{
	width: 40rpx;
	height: 40rpx;
	position: absolute;
	top: 0rpx;
	left: 0rpx;
	background-color:#FF9900;
	color: #fff;
	font-weight: bold;
	font-size: 28rpx;
	text-align: center;
}
.con_text{
	margin: 15rpx 0rpx;
	padding-left: 50rpx;
	font-size: 28rpx;
	color: #2d2d2d;
}
.con_date{
	text-align: right;
	font-size: 24rpx;
	margin: 25rpx 0px;
}
.dataclass{
	padding: 3px 6px;
	    background-color: antiquewhite;
}
</style>
